<?php
namespace app\np\command;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\console\input\Argument;
use think\Db;
use think\Config;
use think\Cache;
class Platform extends Command
{
    protected function configure()
    {
        $this->setName('platform')->setDescription('platform');

    }
    protected function execute(Input $input, Output $output)
    {

       //每分钟执行平仓

        $platform=  Db::name('configs')->where('group_config_id',7)->select();
        $platformArr = [];
        if (!empty($platform)){
            foreach($platform as $k=>$v){
                $platformArr[$v['key']] = $v['value'];
            }
        }
        $options = [
            'type'   => 'redis',
            // 服务器地址
            'host'       => '47.93.19.32',
            //
            'port'       => '6379',
            //redis 密码
            'password' => 'redis.123@.',
            //
            'expire' => 60*60*24*7,
            'select'     => '99',
            'prefix'     => '',
        ];
        $haander = new \think\cache\driver\Redis($options);
            if($haander->has("platforms")){
                $platformCache =  $haander->get("platforms");
                $platformCache[$platformArr['platform_ke']]  = $platformArr;
                $haander->set("platforms",$platformCache);
            }else{
                $platformCache[$platformArr['platform_ke']]  = $platformArr;
                $haander->set("platforms",$platformCache);
            }







    }
}